package com.gator.desig_mode.combination;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 何章怀晓 hezhanghuaixiao
 * @version V1.0
 * @desc 学院
 */
public class College extends School {

  //实际指向的是系
  private List<School> sys = new ArrayList<>();

  public College(String name, String desc) {
    super(name, desc);
  }

  public College(List<School> sys) {
    this.sys = sys;
  }

  @Override
  protected int add(School school) {

    boolean add = sys.add(school);
    if (add) {
      return 1;
    }
    return 0;
  }

  @Override
  protected int rem(School school) {
    boolean remove = sys.remove(school);
    if (remove) {
      return 1;
    }
    return 0;
  }

  @Override
  public String getDesc() {
    return super.getDesc();
  }


  @Override
  public String getName() {
    return super.getName();
  }

  public List<School> getSys() {
    return sys;
  }


  @Override
  protected void print() {

    System.out.println("-----" + getName() + "----------");
    for (School iten : sys
    ) {
      iten.print();
    }
  }
}
